package org.jivesoftware.smack.packet;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Registration extends IQ
{
  private String instructions = null;
  private Map<String, String> attributes = new HashMap();
  private List<String> requiredFields = new ArrayList();
  private boolean registered = false;
  private boolean remove = false;

  public String getInstructions()
  {
    return this.instructions;
  }

  public void setInstructions(String paramString)
  {
    this.instructions = paramString;
  }

  public Map<String, String> getAttributes()
  {
    return this.attributes;
  }

  public void setAttributes(Map<String, String> paramMap)
  {
    this.attributes = paramMap;
  }

  public List<String> getRequiredFields()
  {
    return this.requiredFields;
  }

  public void addAttribute(String paramString1, String paramString2)
  {
    this.attributes.put(paramString1, paramString2);
  }

  public void setRegistered(boolean paramBoolean)
  {
    this.registered = paramBoolean;
  }

  public boolean isRegistered()
  {
    return this.registered;
  }

  public String getField(String paramString)
  {
    return (String)this.attributes.get(paramString);
  }

  public List<String> getFieldNames()
  {
    return new ArrayList(this.attributes.keySet());
  }

  public void setUsername(String paramString)
  {
    this.attributes.put("username", paramString);
  }

  public void setPassword(String paramString)
  {
    this.attributes.put("password", paramString);
  }

  public void setRemove(boolean paramBoolean)
  {
    this.remove = paramBoolean;
  }

  public String getChildElementXML()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<query xmlns=\"jabber:iq:register\">");
    if ((this.instructions != null) && (!this.remove))
      localStringBuilder.append("<instructions>").append(this.instructions).append("</instructions>");
    if ((this.attributes != null) && (this.attributes.size() > 0) && (!this.remove))
    {
      Iterator localIterator = this.attributes.keySet().iterator();
      while (localIterator.hasNext())
      {
        String str1 = (String)localIterator.next();
        String str2 = (String)this.attributes.get(str1);
        localStringBuilder.append("<").append(str1).append(">");
        localStringBuilder.append(str2);
        localStringBuilder.append("</").append(str1).append(">");
      }
    }
    else if (this.remove)
    {
      localStringBuilder.append("</remove>");
    }
    localStringBuilder.append(getExtensionsXML());
    localStringBuilder.append("</query>");
    return localStringBuilder.toString();
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smack.packet.Registration
 * JD-Core Version:    0.6.1
 */